{template 'common/header-agent'}
<ol class="breadcrumb">
	<li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
	<li><a href="{url 'agent/agent_show'}">代理商管理</a></li>
	<li class="active">代理商信息</li>
</ol>
<ul class="nav nav-tabs">
	<li {if $do == 'info'}class="active"{/if}><a href="{php echo url('agent/agent_info/info');}">信息资料</a></li>
	<li {if $do == 'record'}class="active"{/if}><a href="{php echo url('agent/agent_info/record');}">消费记录</a></li>
	<li {if $do == 'recharge'}class="active"{/if}><a href="javascript:alert('等待系统更新')">充值续费</a></li>
	<li {if $do == 'discountprice'}class="active"{/if}><a href="javascript:alert('等待系统更新')">购买套餐</a></li>
	<li {if $do == 'changepwd'}class="active"{/if}><a href="{php echo url('agent/agent_info/changepwd');}">修改密码</a></li>
</ul>
{if $do == 'info'}
<div class="clearfix">
		<div class="panel panel-default">
			<div class="panel-heading">信息资料</div>
			<div class="panel-body">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">代理商名称</label>
				<div class="col-sm-9 col-xs-12">
						<input type="text" name="name" class="form-control" value="{$user['name']}" readonly />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">账户余额</label>
				<div class="col-sm-9 col-xs-12">
						<input type="text" name="name" class="form-control" value="{$user['moneybalance']}" readonly />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">用户数量</label>
				<div class="col-sm-9 col-xs-12">
						<input type="text" name="name" class="form-control" value="{$user['usercount']}" readonly />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">到期时间</label>
				<div class="col-sm-9 col-xs-12">
						<input type="text" name="name" class="form-control" value="{php echo date('Y-m-d H:i:s',$user['endtime']);}" readonly />
				</div>
			</div>
			
			</div>
		</div>
</div>
{/if}
{if $do == 'record'}
<div class="clearfix">
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="" method="get" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="agent">
				<input type="hidden" name="a" value="info">
				<input type="hidden" name="do" value="record">
				<input type="hidden" name="cateid" value="{$_GPC['cateid']}">
				<input type="hidden" name="createtime" value="{$_GPC['createtime']}">
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">产生时间</label>
					<div class="col-sm-8 col-lg-9 col-xs-12">
						<div class="btn-group">
							<a href="{php echo filter_url('createtime:0');}" class="btn {if $_GPC['createtime'] == 0}btn-primary{else}btn-default{/if}">不限</a>
							<a href="{php echo filter_url('createtime:3');}" class="btn {if $_GPC['createtime'] == 3}btn-primary{else}btn-default{/if}">三天内</a>
							<a href="{php echo filter_url('createtime:7');}" class="btn {if $_GPC['createtime'] == 7}btn-primary{else}btn-default{/if}">一周内</a>
							<a href="{php echo filter_url('createtime:30');}" class="btn {if $_GPC['createtime'] == 30}btn-primary{else}btn-default{/if}">一月内</a>
							<a href="{php echo filter_url('createtime:90');}" class="btn {if $_GPC['createtime'] == 90}btn-primary{else}btn-default{/if}">三月内</a>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">标题</label>
					<div class="col-sm-8 col-lg-3 col-xs-12">
						<input class="form-control" name="title" id="" type="text" value="{$_GPC['title']}">
					</div>
					<div class="pull-left col-xs-12 col-sm-2 col-lg-2">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
					</div>
				</div>
			</form>
		</div>
	</div>
		<div class="panel panel-default">
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead>
						<tr>
							<th width="80">排序</th>
							<th width="100">代理商名称</th>
							<th width="300">费用用途</th>
							<th>产生费用</th>
							<th>操作时间</th>
							<th>是否成功</th>
							<th class="text-right">操作</th>
						</tr>
					</thead>
					<tbody>
					{loop $users $user}
						<input type="hidden" name="ids[]" value="{$about['id']}" />
						<tr>
							<td>{$user['id']}</td>
							<td>{$user['agentid']}</td>
							<td>{$user['des']}</td>
							<td>{$user['amount']}</td>
							<td>{php echo date('Y-m-d H:i:s',$user['times']);}</td>
							<td>{php echo m_kind($user['status']);}</td>
							<td align='center'>
								<a href="#">确认</a>
							</td>
						</tr>
					{/loop}
					</tbody>
				</table>
			</div>
		</div>
		{$pager}
</div>
{/if}
{if $do == 'recharge'}
<div class="clearfix">
抱歉，该功能还在完善中!
</div>
{/if}
{if $do == 'discountprice'}
<div class="clearfix">
抱歉，该功能还在完善中!
</div>
{/if}
{if $do == 'changepwd'}
	<div class="clearfix">
		<form action="" method="post" class="form-horizontal form" onsubmit="return formcheck(this)">
			<h5 class="page-header">修改密码</h5>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">代理商帐号</label>
				<div class="col-sm-9 col-xs-12">
						<input type="text" name="name" class="form-control" value="{$user['name']}" readonly />
						<div class="help-block">只能用'0-9'、'a-z'、'A-Z'、'.'、'@'、'_'、'-'、'!'以内范围的字符</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">代理商密码</label>
				<div class="col-sm-9 col-xs-12">
						<input type="password" name="oldpassword" class="form-control" value="" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="color:red">新密码</label>
				<div class="col-sm-9 col-xs-12">
						<input type="password" name="password" class="form-control" value="" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="color:red">确认密码</label>
				<div class="col-sm-9 col-xs-12">
					<input type="password" name="repassword" class="form-control" value="" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
				<div class="col-sm-9 col-xs-12">
						<input name="submit" type="submit" value="提交" class="btn btn-primary" />
						<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
	function formcheck(form) {
		if (!form['name'].value) {
			alert('请填写代理商帐号！');
			form['name'].focus();
			return false;
		}
		if (!form['oldpassword'].value) {
			alert('请填写代理商密码！');
			form['oldpassword'].focus();
			return false;
		}
		if (!form['password'].value) {
			alert('请填写新密码！');
			form['password'].focus();
			return false;
		}
		if (form['oldpassword'].value == form['pw2'].value) {
			alert('新密码与原密码一致，请检查！');
			form['oldpassword'].focus();
			return false;
		}
		if (form['password'].value.length < 6 ) {
			alert('代理商密码不得小于6个字符！');
			form['password'].focus();
			return false;
		}
		if (form['password'].value != form['repassword'].value) {
			alert('两次输入的新密码不一致，请重新输入！');
			form['password'].focus();
			return false;
		}
	}
	</script>
{/if}
{template 'common/footer-gw'}
